<extend name="Public/base" />
<block name="style">
<style>
@font-face{
    font-family: layui-icon;
    src:url(__STATIC__/layui/font/iconfont.eot?v=1.0.9);
    src:url(__STATIC__/layui/font/iconfont.eot?v=1.0.9#iefix) format('embedded-opentype'), url(__STATIC__/layui/font/iconfont.svg?v=1.0.9#iconfont) format('svg'), url(__STATIC__/layui/font/iconfont.woff?v=1.0.9) format('woff'), url(__STATIC__/layui/font/iconfont.ttf?v=1.0.9) format('truetype')
}
.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-upload-button{position:relative;display:inline-block;vertical-align:middle;min-width:60px;height:38px;line-height:38px;border:1px solid #DFDFDF;border-radius:2px;overflow:hidden;background-color:#fff;color:#666;}.layui-btn,.layui-input,.layui-select,.layui-textarea,.layui-upload-button{outline:0;-webkit-transition:border-color .3s cubic-bezier(.65,.05,.35,.5);transition:border-color .3s cubic-bezier(.65,.05,.35,.5);-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important;}.layui-upload-button input{position:absolute;left:0;top:0;z-index:10;font-size:100px;width:100%;height:100%;}.layui-upload-button input,.layui-upload-file{opacity:.01;filter:Alpha(opacity=1);cursor:pointer;}.layui-upload-icon{display:block;margin:0 15px;text-align:center;}
    #layui-upload-iframe{
        display: none;
    }
</style>
</block>
<block name="script">
<script src="__STATIC__/layui/layui.js"></script>
<script>
layui.use(['layer','upload'], function(){
    var layer = layui.layer;
    var upload = layui.upload;
    layui.upload({
        url:"{:U('upload')}",
        ext:'jpg|png|gif',
        before: function(input){
            console.log('文件上传中');
        },
        success: function(res){
            if(res.status){
                location.reload(true)
            }else{
                layer.open({
                    title:'图片上传失败',
                    content:res.error
                });
            }
        }
    });
});
</script>
</block>
<block name="body">
    <div class="main-title">
        <h2>图片列表</h2>
    </div>
    <div class="cf">
        <input type="file" name="img" class="layui-upload-file">
    </div>
    <!-- 数据表格 -->
    <div class="data-table">
        <table class="table_style1">
            <thead class="table_header">
                <tr>
                    <td width="80">id</td>
                    <td width="100">缩略图</td>
                    <td>图片url</td>
                    <td width="80">上传人</td>
                    <td width="180">更新时间</td>
                    <td width="80">操作</td>
                </tr>
            </thead>
            <tbody>
                <volist name="lists" id="list">
                    <tr>
                        <td>{$list.id}</td>
                        <td><img src="{$list.oss_img_url}" style="max-width:100px;margin:0 auto;display: block" /></td>
                        <td class="text_left">{$list.oss_img_url}</td>
                        <td>{$list.update_user}</td>
                        <td>{$list.update_time|date="Y-m-d H:i:s",###}</td>
                        <td><a href="{:U('del',array('id'=>$list['id']))}">删除</a></td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</block>